---
title: Creating Materials  
---

There are generally three ways to create materials:

## 1. Manual Creation

<img src="https://gw.alipayobjects.com/zos/OasisHub/b01b0ee2-317e-4acb-8c2f-e07736179d67/image-20240206163405147.png" />

## 2. Materials from Models

Refer to the [Model Import and Usage](/en/docs/graphics/model/use/) tutorial. First, import the model into the editor. In most cases, the model will automatically bind its material, requiring no user action.

### 2.1. Remap Material

To modify the model's material, click the **`duplicate and remap`** button to generate a copy of the material. Note that **Remap** will modify the model's preset, affecting all model instances (as shown below):

<img src="https://gw.alipayobjects.com/zos/OasisHub/4a41f66e-5523-43f0-a9b5-4028b9d14cbc/2025-01-24%25252015.30.31.gif" />

### 2.2. Incremental Modification

To modify only a specific model's material, use the incremental modification feature:

<img src="https://gw.alipayobjects.com/zos/OasisHub/5d2409f2-a7b2-4b5e-9e6a-9845c3358af3/2025-01-24%25252015.32.04.gif" />

## 3. Bind Material

Directly drag the material into the scene to bind it.

<img src="https://gw.alipayobjects.com/zos/OasisHub/62d6a8cb-fd70-4c37-beab-9dacc8ae4d5b/2025-05-23%25252017.13.59.gif" />

## 4. Script-Based Method

You can also create or modify materials via scripts. Below is a demo that replaces a material by attaching a script to a cube entity:

```ts showLineNumbers
export default class extends Script {
  onStart() {
    // Get all renderers
    const renderers = [];
    this.entity.getComponentsIncludeChildren(MeshRenderer, renderers);
    const renderer = renderers[0];

    // Modify material directly
    const material = renderer.getMaterial();
    material.baseColor.set(1, 0, 0, 1);

    // Or replace the material
    const pbrMaterial = new PBRMaterial(engine);
    const material = renderer.setMaterial(material);
  }
}
```